<?php
$this->load("header");
$this->navbar();
?>
<link href = '<?php echo CSS_PATH . "enquiry/style_table_1.css"; ?>' rel="stylesheet" >
<link href = '<?php echo CSS_PATH . "enquiry/responsive_table.css"; ?>' rel="stylesheet" >
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
    function myCall() {
        var request = $.ajax({
            url: "?show_all",
            type: "POST",
            dataType: "html"
        });

        request.done(function(msg) {
            $("#data_reply").html(msg);
        });

        request.fail(function(jqXHR, textStatus) {
            alert("Request failed: " + textStatus);
        });
    }
    function myCall2() {
        var request = $.ajax({
            url: "?show_recent",
            type: "POST",
            dataType: "html"
        });

        request.done(function(msg) {
            $("#data_reply").html(msg);
        });

        request.fail(function(jqXHR, textStatus) {
            alert("Request failed: " + textStatus);

        });
    }

</script>
<form action="" method="POST">
    <div id="page-wrap" style="clear: both">
        <!-- Single button -->
        <div class="group_select_desk" style="width: 90%;">
            <div style="width:30%;float:left"><h4 style="margin-left:-5px;color:blue">ENQUIRIES</h4></div>
            <div style="width:70%;display:block;float:left">
                <?php if (($_SESSION['Del'] == "Yes") or ($_SESSION['admin'] == 1)) { ?>  <div class="btn-group" style="float: right;">
                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            select <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="javascript:allCheck('chkDel[]',true)">Select All</a></li>
                            <li><a href="javascript:allCheck('chkDel[]',false)">Select None</a></li> 
                            <li><a href="javascript:reserveCheck('chkDel[]')" >Invert Select</a></li>
                        </ul>
                    </div>
                    <?php
                }
                if (($_SESSION['Del'] == "Yes") or ($_SESSION['admin'] == 1)) {
                    ?>
                    <div class="btn-group" style="margin-right: 10px;float: right">
                        <button type="submit" class="btn btn-default" style="width:80px">
                            Delete 
                        </button>
                    </div> 
                    <?php
                }
                if (($_SESSION['Addd'] == "Yes") or ($_SESSION['admin'] == 1)) {
                    ?>
                    <div class="btn-group" style="margin-right: 10px;float: right">
                        <a href = "?add=1" >
                            <button type="button" class="btn btn-default"  style="width:80px">
                                Add 
                            </button></a> </div>
                    <?php
                }
                ?>
            </div>
        </div>
        <div class="group_select_mob">
            <span><h4 style="margin-left:10px;color:blue">ENQUIRIES</h4></span><br>

            <?php
            if (($_SESSION['Del'] == "Yes") or ($_SESSION['admin'] == 1)) {
                ?>  <div class="btn-group" style="float: left;">
                    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                        select <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="javascript:allCheck('chkDel[]',true)">Select All</a></li>
                        <li><a href="javascript:allCheck('chkDel[]',false)">Select None</a></li> 
                        <li><a href="javascript:reserveCheck('chkDel[]')" >Invert Select</a></li>
                    </ul>
                </div>
                <?php
            }
            ?>

            <div class="btn-group"  style="float: right">
                <a class="btn dropdown-toggle" data-toggle="dropdown" href="#" >
                    Action&nbsp;
                    <span class="caret"></span>
                </a>
                <ul class="dropdown-menu"  style="float:left;margin-left: -84px">
                    <!-- dropdown menu links -->
                    <?php
                    if (($_SESSION['Addd'] == "Yes") or ($_SESSION['admin'] == 1)) {
                        ?>
                        <li><a href="add_customer"><i class="icon-file"></i>New</a></li>
                    <?php } ?>
                    <li><a href=""><i class="icon-print"></i>Print</a></li> 
                    <li><a href="" ><i class="icon-list"></i>Report</a></li> 
                    <?php
                    if (($_SESSION['Del'] == "Yes") or ($_SESSION['admin'] == 1)) {
                        ?>
                        <li><button type="submit" style="border:none;background:none;margin-left: 20px">Delete</button></li>
                        <?php
                    }
                    ?>
                    <li><a href="" ><i class="icon-list-alt"></i>VAT Report</a></li> 
                    <li><a href="" ><i class="icon-th"></i>Options</a></li> 
                </ul>
            </div>
        </div><br><br>
        <table  class="table1" id="table_pro">
            <thead  class="thead1">
                <tr>
                    <th>&nbsp;</th>
                    <th>Enq #</th>
                    <th>Date</th>
                    <th>Student name</th>
                    <th>Father's name</th>
                    <th>Class</th>
                    <th>Application</th>
                    <th>Test</th>
                    <th>Admitted</th>
                    <th>Address</th>
                    <th>Street</th>
                    <th>Area</th>

                </tr>
            </thead>
            <tbody id="data_reply">
                <?php
                foreach ($this->enq_display as $key => $value) {
                    ?>
                    <tr>
                        <td><input type="checkbox" name="chkDel[]" id="chkDel<?= $i; ?>" value="<?php echo $value['enqno']; ?>"></td>
                        <td><?php echo $value['enqno']; ?></td>
                        <td><?php echo $value['enqdate']; ?></td>                
                        <td><?php
                            if (($_SESSION['Edit'] == "Yes") or ($_SESSION['admin'] == 1)) {
                                echo '<a href=?edit=' . $value['enqno'] . '>' . $value['name'] . '</a>';
                            } else {
                                echo $value['name'];
                            }
                            ?>            
                        </td>
                        <td><?php echo $value['father']; ?></td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td><?php echo $value['admtoclass']; ?></td>
                        <td><?php echo $value['caddress']; ?></td>
                        <td><?php echo $value['cstreet']; ?></td>
                        <td><?php echo $value['carea']; ?></td>
                        <td>&nbsp;</td>

                    </tr>
                <?php } ?>

            </tbody>
        </table>
        <div align="center"><button type="button" class="btn btn-info" onclick="myCall()">SHOW ALL</button><button type="button" style="margin-left:8px" class="btn btn-info" onclick="myCall2()">SHOW RECENT</button></div>
    </div>
</form>
<?php
$this->load("footer");
?>